/**
 *  通用工具类
 * 
*/

exports.toolsUtil = {
    // 删除对象参数为空的属性
    deleteNullObj: (keywords) => {
        if (!keywords) return keywords;
        for (let key in keywords) {
            if (keywords[key] === '') 
            delete keywords[key];
        }
        return keywords;
    },

    // 拼接对象数组的某属性值
    montageStr: (objs, field, isReturnStr = false) => {
        let result = objs.map((item, index) => {
            return item[field];
        });
        if(isReturnStr) return result.join(',');
        return result;
    }
}